package com.view.commonView;

import java.awt.Toolkit;
import java.io.File;

import javax.swing.JDialog;
import javax.swing.JOptionPane;

/**
 * @author Diego Iacono
 *
 */
public class MessageDialog
{
   public static final int WARNING_ICON = JOptionPane.WARNING_MESSAGE;
   public static final int ERROR_ICON = JOptionPane.ERROR_MESSAGE;
   public static final int INFORMATION_ICON = JOptionPane.INFORMATION_MESSAGE;
   public static final int QUESTION_ICON = JOptionPane.QUESTION_MESSAGE;
   
   /**
    * Display the Message Dialog
    * @param message
    * @param title
    * @param optIcon
    */
   public static void showDialog(String message, String title, int optIcon)
   {
      JOptionPane optionPane = new JOptionPane(message, optIcon);
      JDialog dialog = optionPane.createDialog(title);
      dialog.setAlwaysOnTop(true);
      dialog.setModal(true);
      dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
      dialog.setIconImage(Toolkit.getDefaultToolkit().getImage(
         getPath() + IconSrc.WINDOW_MENU_ICON));
      dialog.setVisible(true);

   }
   
   /**
    * retrive the local App Path
    */
    private static String getPath()
      {
         File currentDir = new File("");
         String pathStr = currentDir.getAbsolutePath() + "\\icon\\";
         return pathStr;
      }
}
